'''【AC】涉及：遍历时处理'''
def method(a: list):
    result = 0
    # 得s为不同的段的“xor”值
    s = [a[0]]
    for i in range(1, len(a) - 2):
        s.append(s[-1] ^ a[i])
    # 枚举，len-2 --> 1
    p = a[len(a) - 2]
    for l in range(len(a) - 2, 0, -1):
        rt = s[l-1] + p
        result = max(result, rt)
        p |= a[l - 1] 
    return result + a[-1]

if __name__ == '__main__':
    _ = input()
    nums = [int(x) for x in input().split(' ')]
    print(method(nums))
